import { parseTime } from '@/utils'
export const TableConfig = [
  // { type: 'selection' },
  { prop: 'name', label: '名称' },
  { prop: 'jobSort', label: '排序' },
  { label: '状态',
    slots: [
      {
        render(h, vm, row) {
          const { enabled } = row
          console.log('enabled', enabled)
          return (
            <el-switch v-model={row.enabled} active-value= {true} inactive-value={false} onChange={() => vm.$emit('tableOperate', 'updateStatus', row)}></el-switch>
          )
        }
      }
    ]
  },
  { prop: 'createTime', label: '创建日期', slots: [
    {
      render(h, vm, row) {
        const { createTime } = row
        return (<span>{parseTime(createTime)}</span>)
      }
    }
  ] },
  { label: '操作',
    slots: [
      {
        render(h, vm, row) {
          return ([
            <el-button size='mini' type='primary' icon='el-icon-edit' onClick={ () => vm.$emit('tableOperate', 'editJob', row, '编辑岗位')}/>,
            <el-button type='danger' icon='el-icon-delete' size='mini' onClick={() => vm.$emit('tableOperate', 'delet', row)}/>
          ])
        }
      }
    ]
  }
]

